package com.common.project.voconverter;
import org.apache.commons.collections4.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
public class ${beanName?cap_first}Transfer {

   /**
     * 获取${beanName?cap_first}
     *
     * @param ${beanName?lower_case}VO
     * @return
     */
    public static ${beanName?cap_first} get${beanName?cap_first}(${beanName?cap_first}VO ${beanName?lower_case}VO) {

        if (${beanName?lower_case}VO == null) {
            return null;
        }

        return new ${beanName?cap_first}()
        <#list params as param>
             .set${param.paramName?cap_first}(${beanName?lower_case}VO.get${param.paramName?cap_first}())
        </#list >;
    }


   /**
     * 获取${beanName?cap_first}VO
     *
     * @param ${beanName?lower_case}
     * @return
     */
    public static ${beanName?cap_first}VO get${beanName?cap_first}VO(${beanName?cap_first} ${beanName?lower_case}) {

        if (${beanName?lower_case} == null) {
            return null;
        }

        return new ${beanName?cap_first}VO()
        <#list params as param>
            .set${param.paramName?cap_first}(${beanName?lower_case}.get${param.paramName?cap_first}())
        </#list >;
    }


   /**
     * 获取get${beanName?cap_first}VOList
     *
     * @param ${beanName?lower_case}List
     * @return
     */
    public static List<${beanName?cap_first}VO> get${beanName?cap_first}VO(List<${beanName?cap_first}> ${beanName?lower_case}List) {

        List<${beanName?cap_first}VO> ${beanName?lower_case}VOList = new ArrayList<>();

        if (CollectionUtils.isEmpty(${beanName?lower_case}List)) {
            return ${beanName?lower_case}VOList;
        }

        ${beanName?lower_case}List.stream().filter(${beanName?lower_case} -> ${beanName?lower_case} != null).forEach(${beanName?lower_case} -> {
                ${beanName?lower_case}VOList.add(get${beanName?cap_first}VO(${beanName?lower_case}));
        });

        return ${beanName?lower_case}VOList;

   }
}